home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / POPADBUG.ZIP / 386BUGS.ASM next >
Assembly Source File  |  1990-10-31  |  1KB  |  52 lines

  1.         .386
  2. ;
  3. ; BUGTST.ASM - By: John Lauro
  4. ;              Based on bug found by Jeff Prothero
  5. ;
  6. DATA    SEGMENT  USE16 PUBLIC
  7. MOK     DB       'POPAD ok',13,10,'$'
  8. MNOTOK  DB       '*** POPAD fails test ***',13,10,'$'
  9. DATA    ENDS
  10. ;
  11. ;
  12. STKSEG  SEGMENT  USE16 STACK
  13.         DW       100 DUP(?)
  14. STKSEG  ENDS
  15. ;
  16. ;
  17. CODE    SEGMENT  USE16 PUBLIC
  18.         ASSUME   CS:CODE,SS:STKSEG,DS:DATA
  19. CODES   PROC     FAR
  20. START:  MOV      AX,DATA
  21.         MOV      DS,AX 
  22.  
  23.         mov       eax,12345678
  24.         mov       edx, 0
  25.         mov       edi, 0
  26.         pushad
  27.         popad
  28.  
  29. ; The instruction immediately following popad is the critical
  30. ; instruction.  Simple fix, insert a NOP after popad.
  31.  
  32.         mov       ecx, [edx+edi]
  33.  
  34.         cmp       eax, 12345678
  35.         je        ok
  36.         mov       dx, offset mnotok
  37. outmsg: mov       ah, 09h    ; ConStringOutput
  38.         int       21h
  39.  
  40.         mov       ah, 4ch    ; Exit
  41.         mov       al, 0
  42.         int       21h
  43.  
  44. ok:     mov       dx, offset mok
  45.         jmp       outmsg 
  46.  
  47. CODES   ENDP
  48. CODE    ENDS
  49.         END      START
  50.  
  51.  
  52.